package cn.tedu.douguo.user.controller;


import cn.tedu.douguo.commons.web.JsonResult;
import cn.tedu.douguo.user.pojo.param.UserLoginInfoParam;
import cn.tedu.douguo.user.pojo.param.UserRegInfoParam;
import cn.tedu.douguo.user.pojo.vo.CategoryListVO;
import cn.tedu.douguo.user.service.CategoryService;
import cn.tedu.douguo.user.service.UserService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

@RestController
@RequestMapping("/category")
@Slf4j
@Valid
@Api( tags = "一（￣︶￣）↗ 分类管理")
public class CategoryController {

    @Autowired
    private CategoryService service;

    //处理展示所有1级分类的请求
    @GetMapping("/list/first")
    @ApiOperation("1级菜谱列表")
    @ApiOperationSupport(order = 401)
    public JsonResult category1(){
        log.debug("开始处理展示1级菜谱列表的请求...");
        List<CategoryListVO> listFirst = service.listFirst();
        return JsonResult.ok(listFirst);
    }

    //处理展示所有2级分类的请求
    @GetMapping("/list/second")
    @ApiOperation("2级菜谱列表")
    @ApiOperationSupport(order = 402)
    public JsonResult category2(){
        log.debug("开始处理展示2级菜谱列表的请求...");
        List<CategoryListVO> listSecond = service.listSecond();
        return JsonResult.ok(listSecond);
    }


    //处理展示所有3级分类的请求
    @GetMapping("/list/third")
    @ApiOperation("3级菜谱列表")
    @ApiOperationSupport(order = 403)
    public JsonResult category3(){
        log.debug("开始处理展示3级菜谱列表的请求...");
        List<CategoryListVO> listThird = service.listThird();
        return JsonResult.ok(listThird);
    }



}
